package com.ts.conch.auth.base;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ts.conch.entity.TsAdmin;

/**
 * @ClassName: BaseController
 * @Decription: 此处填写类文件说明
 * @Author: IDai
 * @Date: 2021-09-13 15:55 星期一
 **/
public class BaseController {

    public static TsAdmin getLoginUser() {
        TsAdmin admin = new TsAdmin();
        try {
            if (ObjectUtil.isNotNull(StpUtil.getSession().get("tsAdmin"))){
                if (StpUtil.getSession().get("tsAdmin") instanceof TsAdmin){
                    admin = (TsAdmin) StpUtil.getSession().get("tsAdmin");
                    return admin;
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return admin;
    }

}
